<template>
  <div class="day7">
    <div class="title">未来7天预报</div>
    <div class="data">
      <template v-for="item in day7">
        <div class="show">
          <div class="content">
            <div class="text">
              <div class="day">{{ item.date }}</div>
              <div class="date">{{ item.datetime }}</div>
            </div>
            <img class="img" :src="item.src" />
          </div>
          <div class="tmp">
            <div class="max">{{ item.maxTemp }}</div>
            <div class="box"></div>
            <div class="min">{{ item.minTemp }}</div>
          </div>
        </div>
      </template>
    </div>
    <div class="more" @click="jump">30天预报</div>
  </div>
</template>

<script setup>
import { useRouter } from "vue-router";

const props = defineProps({
  day7: {
    type: Array,
  },
});

const router = useRouter();
const jump = () => {
  router.push({
    path: "/weather30",
  });
};
</script>

<style lang="less" scoped>
.day7 {
  padding: 30px 0 14px;
  margin-bottom: 16px;

  border-radius: 16px;
  background-color: #f7f8f9;
  border: 1px solid #f2f4fa;
  .title {
    font-size: 20px;
    font-weight: 500;
    line-height: 22px;
    text-align: center;
    margin-bottom: 28px;
  }
  .data {
    margin-top: 28px;
    padding: 0 24px;
    .show {
      max-width: 768px;
      display: flex;
      margin: 0 auto;
      padding: 9px 0;
      .content {
        display: flex;
        justify-content: center;
        align-items: center;
        .text {
          .day {
            font-size: 18px;
          }
          .date {
            font-size: 16px;
            color: rgba(0, 0, 0, 0.5);
          }
        }
        .img {
          display: inline-block;
          vertical-align: middle;
          width: 30px;
          height: 30px;
          margin: 0 0 0 58px;
        }
      }

      .tmp {
        flex: 1;
        display: flex;
        min-width: 95px;
        margin-left: 30px;
        align-items: center;
        .max .min {
          display: inline-block;
          vertical-align: middle;
          font-size: 18px;
        }
        .box {
          flex: 1;
          display: inline-block;
          vertical-align: middle;
          height: 5px;
          border-radius: 5px;
          margin: 0 20px;
          background-image: linear-gradient(to right, #f18360, #427bff);
        }
      }
    }
  }
  .more {
    padding-top: 5px;
    border-top: 1px solid #dedfe2;
    height: 35px;
    text-align: center;
    align-items: center;
    cursor: pointer;
    font-size: 16px;
    line-height: 35px;
    color: #427bff;
  }
}
</style>